Nightly Per-Antenna Quality Summary Notebook¶

Josh Dillon, Last Revised February 2021

This notebooks brings together as much information as possible from ant_metrics, auto_metrics and redcal to help figure out which antennas are working properly and summarizes it in a single giant table. It is meant to be lightweight and re-run as often as necessary over the night, so it can be run when any of those is done and then be updated when another one completes.

Contents:¶

  • Table 1: Overall Array Health
  • Table 2: RTP Per-Antenna Metrics Summary Table
  • Figure 1: Array Plot of Flags and A Priori Statuses
In [1]:
import os
os.environ['HDF5_USE_FILE_LOCKING'] = 'FALSE'
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
pd.set_option('display.max_rows', 1000)
from hera_qm.metrics_io import load_metric_file
from hera_cal import utils, io, redcal
import glob
import h5py
from copy import deepcopy
from IPython.display import display, HTML
from hera_notebook_templates.utils import status_colors
from hera_mc import mc
from pyuvdata import UVData

%matplotlib inline
%config InlineBackend.figure_format = 'retina'
display(HTML("<style>.container { width:100% !important; }</style>"))
In [2]:
# If you want to run this notebook locally, copy the output of the next cell into the first few lines of this cell.

# JD = "2459122"
# data_path = '/lustre/aoc/projects/hera/H4C/2459122'
# ant_metrics_ext = ".ant_metrics.hdf5"
# redcal_ext = ".maybe_good.omni.calfits"
# nb_outdir = '/lustre/aoc/projects/hera/H4C/h4c_software/H4C_Notebooks/_rtp_summary_'
# good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
# os.environ["JULIANDATE"] = JD
# os.environ["DATA_PATH"] = data_path
# os.environ["ANT_METRICS_EXT"] = ant_metrics_ext
# os.environ["REDCAL_EXT"] = redcal_ext
# os.environ["NB_OUTDIR"] = nb_outdir
# os.environ["GOOD_STATUSES"] = good_statuses
In [3]:
# Use environment variables to figure out path to data
JD = os.environ['JULIANDATE']
data_path = os.environ['DATA_PATH']
ant_metrics_ext = os.environ['ANT_METRICS_EXT']
redcal_ext = os.environ['REDCAL_EXT']
nb_outdir = os.environ['NB_OUTDIR']
good_statuses = os.environ['GOOD_STATUSES']
print(f'JD = "{JD}"')
print(f'data_path = "{data_path}"')
print(f'ant_metrics_ext = "{ant_metrics_ext}"')
print(f'redcal_ext = "{redcal_ext}"')
print(f'nb_outdir = "{nb_outdir}"')
print(f'good_statuses = "{good_statuses}"')
JD = "2459858"
data_path = "/mnt/sn1/2459858"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 10-5-2022
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2459858/zen.2459858.25291.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

# get a list of all ant_metrics files
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{ant_metrics_ext}')
ant_metrics_files = sorted(glob.glob(glob_str))

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1862 ant_metrics files matching glob /mnt/sn1/2459858/zen.2459858.?????.sum.ant_metrics.hdf5

Load chi^2 info from redcal¶

In [8]:
use_redcal = False
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{redcal_ext}')

redcal_files = sorted(glob.glob(glob_str))
if len(redcal_files) > 0:
    print(f'Found {len(redcal_files)} ant_metrics files matching glob {glob_str}')
    post_redcal_ant_flags_dict = {}
    flagged_by_redcal_dict = {}
    cspa_med_dict = {}
    for cal in redcal_files:
        hc = io.HERACal(cal)
        _, flags, cspa, chisq = hc.read()
        cspa_med_dict[cal] = {ant: np.nanmedian(cspa[ant], axis=1) for ant in cspa}

        post_redcal_ant_flags_dict[cal] = {ant: np.all(flags[ant]) for ant in flags}
        # check history to distinguish antennas flagged going into redcal from ones flagged during redcal
        tossed_antenna_lines =  hc.history.replace('\n','').split('Throwing out antenna ')[1:]
        flagged_by_redcal_dict[cal] = sorted([int(line.split(' ')[0]) for line in tossed_antenna_lines])
        
    use_redcal = True
else:
    print(f'No files found matching glob {glob_str}. Skipping redcal chisq.')
Found 175 ant_metrics files matching glob /mnt/sn1/2459858/zen.2459858.?????.sum.known_good.omni.calfits

Figure out some general properties¶

In [9]:
# Parse some general array properties, taking into account the fact that we might be missing some of the metrics
ants = []
pols = []
antpol_pairs = []

if use_auto_metrics:
    ants = sorted(set(bl[0] for bl in auto_metrics['modzs']['r2_shape_modzs']))
    pols = sorted(set(bl[2] for bl in auto_metrics['modzs']['r2_shape_modzs']))
if use_ant_metrics:
    antpol_pairs = sorted(set([antpol for dms in ant_metrics_dead_metrics.values() for antpol in dms.keys()]))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))
if use_redcal:
    antpol_pairs = sorted(set([ant for cspa in cspa_med_dict.values() for ant in cspa.keys()]) | set(antpol_pairs))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))

# Figure out remaining antennas not in data and also LST range
data_files = sorted(glob.glob(os.path.join(data_path, 'zen.*.sum.uvh5')))
hd = io.HERAData(data_files[0])
unused_ants = [ant for ant in hd.antpos if ant not in ants]    
hd_last = io.HERAData(data_files[-1])

Load a priori antenna statuses and node numbers¶

In [10]:
# try to load a priori antenna statusesm but fail gracefully if this doesn't work.
a_priori_statuses = {ant: 'Not Found' for ant in ants}
nodes = {ant: np.nan for ant in ants + unused_ants}
try:
    from hera_mc import cm_hookup

    # get node numbers
    hookup = cm_hookup.get_hookup('default')
    for ant_name in hookup:
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in nodes:
            if hookup[ant_name].get_part_from_type('node')['E<ground'] is not None:
                nodes[ant] = int(hookup[ant_name].get_part_from_type('node')['E<ground'][1:])
    
    # get apriori antenna status
    for ant_name, data in hookup.items():
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in a_priori_statuses:
            a_priori_statuses[ant] = data.apriori

except Exception as err:
    print(f'Could not load node numbers and a priori antenna statuses.\nEncountered {type(err)} with message: {err}')

Summarize auto metrics¶

In [11]:
if use_auto_metrics:
    # Parse modzs
    modzs_to_check = {'Shape': 'r2_shape_modzs', 'Power': 'r2_power_modzs', 
                      'Temporal Variability': 'r2_temp_var_modzs', 'Temporal Discontinuties': 'r2_temp_diff_modzs'}
    worst_metrics = []
    worst_zs = []
    all_modzs = {}
    binary_flags = {rationale: [] for rationale in modzs_to_check}

    for ant in ants:
        # parse modzs and figure out flag counts
        modzs = {f'{pol} {rationale}': auto_metrics['modzs'][dict_name][(ant, ant, pol)] 
                 for rationale, dict_name in modzs_to_check.items() for pol in pols}
        for pol in pols:
            for rationale, dict_name in modzs_to_check.items():
                binary_flags[rationale].append(auto_metrics['modzs'][dict_name][(ant, ant, pol)] > mean_round_modz_cut)

        # parse out all metrics for dataframe
        for k in modzs:
            col_label = k + ' Modified Z-Score'
            if col_label in all_modzs:
                all_modzs[col_label].append(modzs[k])
            else:
                all_modzs[col_label] = [modzs[k]]
                
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
else:
    mean_round_modz_cut = 0

Summarize ant metrics¶

In [12]:
if use_ant_metrics:
    a_priori_flag_frac = {ant: np.mean([ant in apxa for apxa in ant_metrics_apriori_exants.values()]) for ant in ants}
    dead_ant_frac = {ap: {ant: np.mean([(ant, ap) in das for das in ant_metrics_dead_ants_dict.values()])
                                 for ant in ants} for ap in antpols}
    crossed_ant_frac = {ant: np.mean([np.any([(ant, ap) in cas for ap in antpols])
                                      for cas in ant_metrics_crossed_ants_dict.values()]) for ant in ants}
    ant_metrics_xants_frac_by_antpol = {antpol: np.mean([antpol in amx for amx in ant_metrics_xants_dict.values()]) for antpol in antpol_pairs}
    ant_metrics_xants_frac_by_ant = {ant: np.mean([np.any([(ant, ap) in amx for ap in antpols])
                                     for amx in ant_metrics_xants_dict.values()]) for ant in ants}
    average_dead_metrics = {ap: {ant: np.nanmean([dm.get((ant, ap), np.nan) for dm in ant_metrics_dead_metrics.values()]) 
                                 for ant in ants} for ap in antpols}
    average_crossed_metrics = {ant: np.nanmean([cm.get((ant, ap), np.nan) for ap in antpols 
                                                for cm in ant_metrics_crossed_metrics.values()]) for ant in ants}
else:
    dead_cut = 0.4
    crossed_cut = 0.0

Summarize redcal chi^2 metrics¶

In [13]:
if use_redcal:
    cspa = {ant: np.nanmedian(np.hstack([cspa_med_dict[cal][ant] for cal in redcal_files])) for ant in antpol_pairs}
    redcal_prior_flag_frac = {ant: np.mean([np.any([afd[ant, ap] and not ant in flagged_by_redcal_dict[cal] for ap in antpols])
                                            for cal, afd in post_redcal_ant_flags_dict.items()]) for ant in ants}
    redcal_flagged_frac = {ant: np.mean([ant in fbr for fbr in flagged_by_redcal_dict.values()]) for ant in ants}

Get FEM switch states¶

In [14]:
HHautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.sum.autos.uvh5"))
diffautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.diff.autos.uvh5"))

try:
    db = mc.connect_to_mc_db(None)
    session = db.sessionmaker()
    startJD = float(HHautos[0].split('zen.')[1].split('.sum')[0])
    stopJD = float(HHautos[-1].split('zen.')[1].split('.sum')[0])
    start_time = Time(startJD,format='jd')
    stop_time = Time(stopJD,format='jd')

    # get initial state by looking for commands up to 3 hours before the starttime
    # this logic can be improved after an upcoming hera_mc PR
    # which will return the most recent command before a particular time.
    search_start_time = start_time - TimeDelta(3*3600, format="sec")
    initial_command_res = session.get_array_signal_source(starttime=search_start_time, stoptime=start_time)
    if len(initial_command_res) == 0:
        inital_source = "Unknown"
    elif len(command_res) == 1
        inital_source = initial_command_res[0].source
    else:
        # multiple commands
        times = []
        sources = []
        for obj in command_res:
            times.append(obj.time)
            sources.append(obj.source)
        inital_source = sources[np.argmax(times)]
    
    # check for any changes during observing
    command_res = session.get_array_signal_source(starttime=start_time, stoptime=stop_time)
    if len(command_res) == 0:
        # still nothing, set it to None
        obs_source = None
    else:
        obs_source_times = []
        obs_source = []
        for obj in command_res:
            obs_source_times.append(obj.time)
            obs_source.append(obj.source)

    if obs_source is not None:
        command_source = [inital_source] + obs_source
    else:
        command_source = initial_source
    
    res = session.get_antenna_status(starttime=startTime, stoptime=stopTime)
    fem_switches = {}
    right_rep_ant = []
    if len(res) > 0:
        for obj in res:
            if obj.antenna_number not in fem_switches.keys():
                fem_switches[obj.antenna_number] = {}
            fem_switches[obj.antenna_number][obj.antenna_feed_pol] = obj.fem_switch
        for ant, pol_dict in fem_switches.items():
            if pol_dict['e'] == initial_source and pol_dict['n'] == initial_source:
                right_rep_ant.append(ant)
except Exception as e:
    print(e)
    initial_source = None
    command_source = None
    right_rep_ant = []
  Cell In [14], line 19
    elif len(command_res) == 1
                              ^
SyntaxError: expected ':'

Find X-engine Failures¶

In [15]:
read_inds = [1, len(HHautos)//2, -2]
x_status = [1,1,1,1,1,1,1,1]
s = UVData()
s.read(HHautos[1])

nants = len(s.get_ants())
freqs = s.freq_array[0]*1e-6
nfreqs = len(freqs)

antCon = {a: None for a in ants}
rightAnts = []
for i in read_inds:
    s = UVData()
    d = UVData()
    s.read(HHautos[i])
    d.read(diffautos[i])
    for pol in [0,1]:
        sm = np.abs(s.data_array[:,0,:,pol])
        df = np.abs(d.data_array[:,0,:,pol])
        sm = np.r_[sm, np.nan + np.zeros((-len(sm) % nants,len(freqs)))]
        sm = np.nanmean(sm.reshape(-1,nants,nfreqs),axis=1)
        df = np.r_[df, np.nan + np.zeros((-len(df) % nants,len(freqs)))]
        df = np.nanmean(df.reshape(-1,nants,nfreqs),axis=1)

        evens = (sm + df)/2
        odds = (sm - df)/2
        rat = np.divide(evens,odds)
        rat = np.nan_to_num(rat)
        for xbox in range(0,8):
            xavg = np.nanmean(rat[:,xbox*192:(xbox+1)*192],axis=1)
            if np.nanmax(xavg)>1.5 or np.nanmin(xavg)<0.5:
                x_status[xbox] = 0
    for ant in ants:
        for pol in ["xx", "yy"]:
            if antCon[ant] is False:
                continue
            spectrum = s.get_data(ant, ant, pol)
            stdev = np.std(spectrum)
            med = np.median(np.abs(spectrum))
            if (initial_source == 'digital_noise_same' or initial_source == 'digital_noise_different') and med < 10:
                antCon[ant] = True
            elif (initial_source == "load" or initial_source == 'noise') and 80000 < stdev <= 4000000 and antCon[ant] is not False:
                antCon[ant] = True
            elif initial_source == "antenna" and stdev > 500000 and med > 950000 and antCon[ant] is not False:
                antCon[ant] = True
            else:
                antCon[ant] = False
            if np.min(np.abs(spectrum)) < 100000:
                antCon[ant] = False
for ant in ants:
    if antCon[ant] is True:
        rightAnts.append(ant)
            
x_status_str = ''
for i,x in enumerate(x_status):
    if x==0:
        x_status_str += '\u274C '
    else:
        x_status_str += '\u2705 '
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In [15], line 1
----> 1 read_inds = [1, len(HHautos)//2, -2]
      2 x_status = [1,1,1,1,1,1,1,1]
      3 s = UVData()

NameError: name 'HHautos' is not defined

Build Overall Health DataFrame¶

In [16]:
def comma_sep_paragraph(vals, chars_per_line=40):
    outstrs = []
    for val in vals:
        if (len(outstrs) == 0) or (len(outstrs[-1]) > chars_per_line):
            outstrs.append(str(val))
        else:
            outstrs[-1] += ', ' + str(val)
    return ',<br>'.join(outstrs)
In [17]:
# Time data
to_show = {'JD': [JD]}
to_show['Date'] = f'{utc.month}-{utc.day}-{utc.year}'
to_show['LST Range'] = f'{hd.lsts[0] * 12 / np.pi:.3f} -- {hd_last.lsts[-1] * 12 / np.pi:.3f} hours'

# X-engine status
to_show['X-Engine Status'] = x_status_str

# Files
to_show['Number of Files'] = len(data_files)

# Antenna Calculations
to_show['Total Number of Antennas'] = len(ants)

to_show[' '] = ''
to_show['OPERATIONAL STATUS SUMMARY'] = ''

status_count = {status: 0 for status in status_colors}
for ant, status in a_priori_statuses.items():
    if status in status_count:
        status_count[status] = status_count[status] + 1
    else:
        status_count[status] = 1
to_show['Antenna A Priori Status Count'] = '<br>'.join([f'{status}: {status_count[status]}' for status in status_colors if status in status_count and status_count[status] > 0])

to_show['Commanded Signal Source'] = ', '.join(commanded_source)
to_show['Antennas in Commanded State (reported)'] = f'{len(right_rep_ant)} / {len(ants)} ({len(right_rep_ant) / len(ants):.1%})'
to_show['Antennas in Commanded State (observed)'] = f'{len(rightAnts)} / {len(ants)} ({len(rightAnts) / len(ants):.1%})'

if use_ant_metrics:
    to_show['Cross-Polarized Antennas'] = ', '.join([str(ant) for ant in ants if (np.max([dead_ant_frac[ap][ant] for ap in antpols]) + crossed_ant_frac[ant] == 1) 
                                                                                 and (crossed_ant_frac[ant] > .5)])

# Node calculations
nodes_used = set([nodes[ant] for ant in ants if np.isfinite(nodes[ant])])
to_show['Total Number of Nodes'] = len(nodes_used)
if use_ant_metrics:
    node_off = {node: True for node in nodes_used}
    not_correlating = {node: True for node in nodes_used}
    for ant in ants:
        for ap in antpols:
            if np.isfinite(nodes[ant]):
                if np.isfinite(average_dead_metrics[ap][ant]):
                    node_off[nodes[ant]] = False
                if dead_ant_frac[ap][ant] < 1:
                    not_correlating[nodes[ant]] = False
    to_show['Nodes Registering 0s'] = ', '.join([f'N{n:02}' for n in sorted([node for node in node_off if node_off[node]])])
    to_show['Nodes Not Correlating'] = ', '.join([f'N{n:02}' for n in sorted([node for node in not_correlating if not_correlating[node] and not node_off[node]])])

# Pipeline calculations    
to_show['  '] = ''
to_show['NIGHTLY ANALYSIS SUMMARY'] = ''
    
all_flagged_ants = []
if use_ant_metrics:
    to_show['Ant Metrics Done?'] = '\u2705'
    ant_metrics_flagged_ants = [ant for ant in ants if ant_metrics_xants_frac_by_ant[ant] > 0]
    all_flagged_ants.extend(ant_metrics_flagged_ants)
    to_show['Ant Metrics Flagged Antennas'] = f'{len(ant_metrics_flagged_ants)} / {len(ants)} ({len(ant_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Ant Metrics Done?'] = '\u274C'
if use_auto_metrics:
    to_show['Auto Metrics Done?'] = '\u2705'
    auto_metrics_flagged_ants = [ant for ant in ants if ant in auto_ex_ants]
    all_flagged_ants.extend(auto_metrics_flagged_ants)    
    to_show['Auto Metrics Flagged Antennas'] = f'{len(auto_metrics_flagged_ants)} / {len(ants)} ({len(auto_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Auto Metrics Done?'] = '\u274C'
if use_redcal:
    to_show['Redcal Done?'] = '\u2705'    
    redcal_flagged_ants = [ant for ant in ants if redcal_flagged_frac[ant] > 0]
    all_flagged_ants.extend(redcal_flagged_ants)    
    to_show['Redcal Flagged Antennas'] = f'{len(redcal_flagged_ants)} / {len(ants)} ({len(redcal_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Redcal Done?'] = '\u274C' 
to_show['Never Flagged Antennas'] = f'{len(ants) - len(set(all_flagged_ants))} / {len(ants)} ({(len(ants) - len(set(all_flagged_ants))) / len(ants):.1%})'

# Count bad antennas with good statuses and vice versa
n_apriori_good = len([ant for ant in ants if a_priori_statuses[ant] in good_statuses.split(',')])
apriori_good_flagged = []
aprior_bad_unflagged = []
for ant in ants:
    if ant in set(all_flagged_ants) and a_priori_statuses[ant] in good_statuses.split(','):
        apriori_good_flagged.append(ant)
    elif ant not in set(all_flagged_ants) and a_priori_statuses[ant] not in good_statuses.split(','):
        aprior_bad_unflagged.append(ant)
to_show['A Priori Good Antennas Flagged'] = f'{len(apriori_good_flagged)} / {n_apriori_good} total a priori good antennas:<br>' + \
                                            comma_sep_paragraph(apriori_good_flagged)
to_show['A Priori Bad Antennas Not Flagged'] = f'{len(aprior_bad_unflagged)} / {len(ants) - n_apriori_good} total a priori bad antennas:<br>' + \
                                            comma_sep_paragraph(aprior_bad_unflagged)

# Apply Styling
df = pd.DataFrame(to_show)
divider_cols = [df.columns.get_loc(col) for col in ['NIGHTLY ANALYSIS SUMMARY', 'OPERATIONAL STATUS SUMMARY']]
try:
    to_red_columns = [df.columns.get_loc(col) for col in ['Cross-Polarized Antennas', 'Nodes Registering 0s', 
                                                          'Nodes Not Correlating', 'A Priori Good Antennas Flagged']]
except:
    to_red_columns = []
def red_specific_cells(x):
    df1 = pd.DataFrame('', index=x.index, columns=x.columns)
    for col in to_red_columns:
        df1.iloc[col] = 'color: red'
    return df1

df = df.T
table = df.style.hide_columns().apply(red_specific_cells, axis=None)
for col in divider_cols:
    table = table.set_table_styles([{"selector":f"tr:nth-child({col+1})", "props": [("background-color", "black"), ("color", "white")]}], overwrite=False)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In [17], line 7
      4 to_show['LST Range'] = f'{hd.lsts[0] * 12 / np.pi:.3f} -- {hd_last.lsts[-1] * 12 / np.pi:.3f} hours'
      6 # X-engine status
----> 7 to_show['X-Engine Status'] = x_status_str
      9 # Files
     10 to_show['Number of Files'] = len(data_files)

NameError: name 'x_status_str' is not defined

Table 1: Overall Array Health¶

In [18]:
HTML(table.render())
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In [18], line 1
----> 1 HTML(table.render())

NameError: name 'table' is not defined
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459858.csv
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In [19], line 4
      2 outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
      3 print(f'Now saving Table 2 to a csv at {outpath}')
----> 4 df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)

NameError: name 'df' is not defined

Build DataFrame¶

In [20]:
# build dataframe
to_show = {'Ant': [f'<a href="{ant_to_report_url(ant)}" target="_blank">{ant}</a>' for ant in ants],
           'Node': [f'N{nodes[ant]:02}' for ant in ants], 
           'A Priori Status': [a_priori_statuses[ant] for ant in ants]}
           #'Worst Metric': worst_metrics, 'Worst Modified Z-Score': worst_zs}
df = pd.DataFrame(to_show)

# create bar chart columns for flagging percentages:
bar_cols = {}
if use_auto_metrics:
    bar_cols['Auto Metrics Flags'] = [float(ant in auto_ex_ants) for ant in ants]
if use_ant_metrics:
    if np.sum(list(a_priori_flag_frac.values())) > 0:  # only include this col if there are any a priori flags
        bar_cols['A Priori Flag Fraction in Ant Metrics'] = [a_priori_flag_frac[ant] for ant in ants]
    for ap in antpols:
        bar_cols[f'Dead Fraction in Ant Metrics ({ap})'] = [dead_ant_frac[ap][ant] for ant in ants]
    bar_cols['Crossed Fraction in Ant Metrics'] = [crossed_ant_frac[ant] for ant in ants]
if use_redcal:
    bar_cols['Flag Fraction Before Redcal'] = [redcal_prior_flag_frac[ant] for ant in ants]
    bar_cols['Flagged By Redcal chi^2 Fraction'] = [redcal_flagged_frac[ant] for ant in ants]  
for col in bar_cols:
    df[col] = bar_cols[col]

# add auto_metrics
if use_auto_metrics:
    for label, modz in all_modzs.items():
        df[label] = modz
z_score_cols = [col for col in df.columns if 'Modified Z-Score' in col]        
        
# add ant_metrics
ant_metrics_cols = {}
if use_ant_metrics:
    for ap in antpols:
        ant_metrics_cols[f'Average Dead Ant Metric ({ap})'] = [average_dead_metrics[ap][ant] for ant in ants]
    ant_metrics_cols['Average Crossed Ant Metric'] = [average_crossed_metrics[ant] for ant in ants]
    for col in ant_metrics_cols:
        df[col] = ant_metrics_cols[col]   

# add redcal chisq
redcal_cols = []
if use_redcal:
    for ap in antpols:
        col_title = f'Median chi^2 Per Antenna ({ap})'
        df[col_title] = [cspa[ant, ap] for ant in ants]
        redcal_cols.append(col_title)

# sort by node number and then by antenna number within nodes
df.sort_values(['Node', 'Ant'], ascending=True)

# style dataframe
table = df.style.hide_index()\
          .applymap(lambda val: f'background-color: {status_colors[val]}' if val in status_colors else '', subset=['A Priori Status']) \
          .background_gradient(cmap='viridis', vmax=mean_round_modz_cut * 3, vmin=0, axis=None, subset=z_score_cols) \
          .background_gradient(cmap='bwr_r', vmin=dead_cut-.25, vmax=dead_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .background_gradient(cmap='bwr_r', vmin=crossed_cut-.25, vmax=crossed_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .background_gradient(cmap='plasma', vmax=4, vmin=1, axis=None, subset=redcal_cols) \
          .applymap(lambda val: 'font-weight: bold' if val < dead_cut else '', subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val < crossed_cut else '', subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .applymap(lambda val: 'color: red' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .bar(subset=list(bar_cols.keys()), vmin=0, vmax=1) \
          .format({col: '{:,.4f}'.format for col in z_score_cols}) \
          .format({col: '{:,.4f}'.format for col in ant_metrics_cols}) \
          .format({col: '{:,.2%}'.format for col in bar_cols}) \
          .applymap(lambda val: 'font-weight: bold', subset=['Ant']) \
          .set_table_styles([dict(selector="th",props=[('max-width', f'70pt')])])

Table 2: RTP Per-Antenna Metrics Summary Table¶

This admittedly very busy table incorporates summary information about all antennas in the array. Its columns depend on what information is available when the notebook is run (i.e. whether auto_metrics, ant_metrics, and/or redcal is done). These can be divided into 5 sections:

Basic Antenna Info: antenna number, node, and its a priori status.

Flag Fractions: Fraction of the night that an antenna was flagged for various reasons. Note that auto_metrics flags antennas for the whole night, so it'll be 0% or 100%.

auto_metrics Details: If auto_metrics is included, this section shows the modified Z-score signifying how much of an outlier each antenna and polarization is in each of four categories: bandpass shape, overall power, temporal variability, and temporal discontinuities. Bold red text indicates that this is a reason for flagging the antenna. It is reproduced from the auto_metrics_inspect.ipynb nightly notebook, so check that out for more details on the precise metrics.

ant_metrics Details: If ant_metrics is included, this section shows the average correlation-based metrics for antennas over the whole night. Low "dead ant" metrics (nominally below 0.4) indicate antennas not correlating with the rest of the array. Negative "crossed ant" metrics indicate antennas that show stronger correlations in their cross-pols than their same-pols, indicating that the two polarizations are probably swapped. Bold text indicates that the average is below the threshold for flagging.

redcal chi^2 Details: If redcal is included, this shows the median chi^2 per antenna. This would be 1 in an ideal array. Antennas are thrown out when they they are outliers in their median chi^2, usually greater than 4-sigma outliers in modified Z-score.

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics Flag Fraction Before Redcal Flagged By Redcal chi^2 Fraction ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric Median chi^2 Per Antenna (Jee) Median chi^2 Per Antenna (Jnn)
3 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 3.719635 -0.254575 -0.439565 0.227771 -0.963429 1.721723 -0.068326 3.413082 0.715129 0.683899 0.423982 1.930215 1.479478
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.487318 3.325154 1.037657 0.841247 -0.058858 1.220900 2.829282 0.073583 0.730660 0.675867 0.426904 3.674221 2.874802
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.389063 -0.261407 0.341375 -0.545381 0.381150 0.802511 0.682540 0.402376 0.734292 0.686551 0.421371 1.858516 1.505515
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.854889 -0.576090 0.609411 0.480509 -0.465538 1.129557 0.809290 14.535296 0.728382 0.682660 0.424029 2.713437 2.573384
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.086612 2.585984 2.290070 2.082399 -0.068942 0.078448 -1.325751 -3.890637 0.725350 0.665642 0.422508 2.794994 2.377804
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.165465 -1.009833 0.622063 0.298861 1.413835 1.593400 -0.471108 1.103215 0.722061 0.678660 0.426379 1.673922 1.433482
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 2.945252 0.254012 1.202960 0.448469 0.494772 -1.014940 -2.238617 -2.694415 0.715492 0.676779 0.433292 1.628426 1.381759
15 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.935944 0.052219 -0.812904 -0.047595 1.043834 0.970910 0.015976 3.643077 0.740213 0.691330 0.420998 2.045728 1.576934
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.965019 -0.472015 0.903029 0.906812 -0.564630 -0.514551 0.727568 2.805525 0.738866 0.685218 0.420912 1.878122 1.515389
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -1.358319 0.241680 0.460526 0.453281 -0.251162 0.687141 2.789780 0.862824 0.730003 0.692873 0.412274 1.774365 1.498594
18 N01 RF_maintenance 100.00% 0.00% 30.72% 0.00% 100.00% 0.00% 4.321906 10.948475 -0.070751 0.094799 0.805586 2.623595 15.259946 31.051255 0.713045 0.459026 0.471594 2.305099 1.564768
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.188428 -1.732696 0.555227 -0.148892 -0.582671 0.402604 13.136635 13.534581 0.728172 0.693398 0.419542 2.411741 2.341897
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.566152 1.893639 -2.809494 1.696538 0.458402 -0.368847 1.364018 -3.793023 0.742432 0.673946 0.429714 1.565570 1.487072
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.061099 -0.565457 -0.608244 -0.837068 -0.015528 0.312250 1.325271 6.055502 0.724828 0.682719 0.424096 3.453677 2.958863
22 N06 not_connected 100.00% 37.70% 0.00% 0.00% 100.00% 0.00% 29.943399 9.259628 -1.162892 -2.175144 10.770103 6.794263 17.936014 7.309993 0.470651 0.626539 0.358101 1.919439 2.592767
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.050477 11.343802 9.197338 9.833530 2.312605 2.962749 3.052500 1.855558 0.032631 0.036936 0.002525 1.168821 1.168592
28 N01 RF_maintenance 100.00% 60.26% 100.00% 0.00% 100.00% 0.00% 14.494409 27.982124 -0.058225 -0.124579 5.303204 5.146940 8.330612 21.245742 0.370846 0.159618 0.237110 4.049399 1.655368
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -1.321510 -0.155497 0.241281 0.329635 0.099417 0.904525 -0.242836 2.540866 0.736364 0.692144 0.408073 1.698831 1.487826
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.686766 -1.051241 0.764606 0.825849 -0.485394 1.037251 15.955391 0.306754 0.729830 0.695173 0.406846 2.588807 2.449240
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.229358 -1.091442 -0.148384 -0.088406 1.618387 6.835389 1.195618 2.837060 0.750130 0.700691 0.419763 2.693987 2.380742
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.004310 24.927127 -0.365296 -1.056592 10.033026 -0.455477 3.812394 1.792792 0.674203 0.612049 0.303361 2.847909 2.839729
33 N02 RF_maintenance 100.00% 0.00% 12.46% 0.00% 100.00% 0.00% 0.046490 13.332841 0.307087 0.984645 0.787502 1.325477 1.903917 31.965259 0.726722 0.496826 0.500637 3.119063 1.635556
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 11.729288 0.814840 3.372854 -2.894663 2.287258 8.237116 1.007570 1.526418 0.041555 0.660588 0.547334 1.242299 2.819015
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.852818 -0.157712 -0.411706 -2.449081 -1.694317 -2.013424 5.574541 -0.092626 0.641817 0.651430 0.444237 2.437763 2.600149
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 8.930102 6.467447 0.565062 0.258802 1.083081 1.116100 0.046378 0.401780 0.735928 0.688791 0.424563 3.127817 2.599197
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.099815 0.214855 0.466834 0.989220 0.543723 1.258885 -0.129116 11.241277 0.738097 0.699937 0.424314 2.744361 2.485849
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.067259 0.137078 0.494715 0.959646 2.413804 4.451760 7.613386 2.105309 0.743352 0.704253 0.422969 2.619883 2.415766
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.153088 -0.022374 0.418368 0.888544 1.853861 0.881101 -0.341634 -0.324394 0.734060 0.693659 0.413406 1.844428 1.529157
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.002042 -0.879352 -1.054403 -0.414307 0.066166 1.021954 -0.492923 -0.405507 0.743635 0.699354 0.408224 1.997533 1.596909
42 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.058323 2.288173 -0.339996 0.517711 -0.136542 0.311442 0.218912 -0.468333 0.748950 0.693201 0.419126 1.797702 1.540356
43 N05 digital_maintenance 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 9.329167 2.289849 9.087143 0.005777 2.268161 0.167157 1.727083 0.973416 0.040481 0.699805 0.506953 1.144283 2.567386
44 N05 digital_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 4.179344 2.577609 0.629934 0.607094 2.762822 0.655986 21.527566 6.104642 0.719621 0.694831 0.397027 2.689767 2.515157
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.548724 -0.029735 0.521300 0.859047 1.894087 -1.038233 -0.148954 22.414157 0.737594 0.688538 0.410516 2.750078 2.301430
46 N05 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.845228 11.904860 -0.371043 9.885481 1.147652 2.842872 0.358188 2.986148 0.733649 0.036808 0.562588 2.868602 1.144492
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 10.940333 0.603875 3.179017 -2.931404 2.322565 5.104108 0.900495 2.798109 0.038239 0.666050 0.551940 1.184582 2.604140
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.042627 3.468368 2.634102 2.294387 0.585636 -0.285007 -4.229243 -4.508992 0.706150 0.669606 0.435081 2.810389 2.617627
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.466857 3.680357 2.462052 2.458225 0.589682 0.715516 -3.769445 -4.283849 0.699125 0.654404 0.431147 2.846111 2.551786
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.921084 21.691361 0.624190 -0.073297 2.880325 3.039599 6.520178 63.025744 0.728405 0.606573 0.399874 3.049229 2.380709
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 24.986796 1.610375 12.098306 1.331501 2.082366 -0.742498 11.117124 6.394250 0.038540 0.698624 0.502413 1.117585 2.291678
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.564190 6.795009 -0.266172 0.050735 5.926776 1.620438 1.175784 -0.093370 0.746612 0.710326 0.412001 2.748438 2.520053
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.165729 2.340693 -0.603036 -0.336907 0.827632 0.617502 3.292689 6.614116 0.750182 0.715242 0.415572 2.937172 2.525178
54 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 10.039540 3.680508 9.194221 0.356749 2.311183 1.935683 2.350213 11.727015 0.045895 0.686949 0.527680 1.331639 2.378104
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 0.726672 12.596434 0.503416 9.987695 6.613247 2.922503 3.157582 0.908921 0.731833 0.033653 0.533567 3.010714 1.138391
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.292531 0.284510 -0.180658 -0.537103 1.455341 3.506734 0.444447 4.706697 0.742981 0.710287 0.394501 4.030437 2.678706
57 N04 RF_maintenance 100.00% 0.54% 0.00% 0.00% 100.00% 0.00% 31.781350 1.009930 3.352906 0.145418 0.348913 1.405336 3.990292 0.569668 0.584599 0.706721 0.384279 3.792097 2.461167
58 N05 digital_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 9.556783 11.884321 9.144094 10.026078 2.366092 3.050427 3.067003 2.530397 0.035550 0.033149 0.001588 1.127802 1.123357
59 N05 digital_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 27.201683 1.551202 -0.791642 0.865188 0.291481 2.403911 3.708576 5.056602 0.655977 0.694982 0.395484 2.485226 2.409908
60 N05 digital_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.550244 11.608508 9.178806 10.007035 2.286661 2.958161 1.934819 2.878506 0.026611 0.026723 0.000649 1.129492 1.124752
61 N06 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 2.373879 2.284263 -1.884060 -1.070354 6.897919 -2.117400 0.449537 3.540206 0.687291 0.644429 0.409312 2.733903 2.427615
62 N06 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.494685 4.107617 2.536677 2.433311 0.426840 1.001561 -3.745448 -4.409988 0.717966 0.673625 0.426260 2.899513 2.591942
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 2.048162 11.937881 -1.135942 3.948177 -0.955461 2.918100 -0.123324 2.998123 0.680953 0.044179 0.607121 2.730828 1.183814
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.350673 -0.432130 -2.507136 -1.071764 -1.521199 -2.411546 0.604692 -1.755261 0.669360 0.648254 0.440286 2.794282 2.554504
65 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 6.950634 5.785288 -0.688175 -0.106757 2.345662 1.669624 4.156878 0.165506 0.677843 0.646420 0.406063 3.087871 2.683112
66 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 6.335546 5.576407 1.102822 0.856391 0.191036 1.960810 -0.161652 1.312138 0.680895 0.651683 0.398861 2.759186 2.406983
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.531508 5.926758 1.039636 0.980895 1.935730 1.269581 0.871852 2.999110 0.682331 0.656710 0.394066 2.569914 2.377630
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 1.408014 27.929527 0.959302 13.506475 1.274608 2.636721 0.621964 11.156998 0.736103 0.030070 0.508832 2.831576 1.115240
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.136279 -0.587709 -0.230232 1.003974 2.443396 0.739528 -0.152178 0.797602 0.740549 0.709792 0.404520 1.530865 1.326879
70 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.002042 -0.551861 -2.607157 0.347352 -0.457429 0.044063 -0.461110 -0.002162 0.752483 0.715848 0.404578 2.875457 2.391042
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.347753 -0.809368 3.274839 0.654002 4.660237 1.929175 0.246911 0.392637 0.742783 0.713611 0.400383 3.278311 2.631218
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 2.659017 0.137409 0.077333 -0.216021 1.823888 2.977129 7.342142 -0.335564 0.738003 0.708958 0.391130 3.224881 2.589546
73 N05 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 9.267143 11.129677 9.036396 9.722874 2.199134 2.821653 3.176917 0.760941 0.026587 0.026686 0.000444 1.129232 1.127189
74 N05 digital_maintenance 100.00% 100.00% 83.35% 0.00% 100.00% 0.00% 10.329840 9.580436 9.442476 9.627222 2.578685 2.623550 2.648771 24.995522 0.030769 0.325145 0.208247 1.139991 1.296174
75 N05 digital_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 5.351118 12.142110 4.203990 10.100037 2.296421 3.149960 18.185435 3.222800 0.689371 0.043745 0.524364 2.459982 1.190394
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 18.127431 20.234170 -0.602161 -1.804118 0.697327 0.031500 13.060809 7.469874 0.616526 0.543194 0.267074 2.849862 2.208009
78 N06 not_connected 100.00% 14.07% 0.00% 0.00% 100.00% 0.00% 31.701631 -1.254080 -1.528550 -1.549288 0.705898 -1.394642 -0.592421 -0.520262 0.521728 0.662670 0.387639 2.585940 2.334804
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.085037 -0.533852 0.795013 1.872873 -1.026380 14.577222 -0.360757 0.009736 0.697646 0.652375 0.420754 3.037932 2.624583
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.335467 0.279527 -1.244127 0.775532 0.441214 -0.345718 -0.121224 -0.646030 0.723855 0.686674 0.419564 2.876164 2.495801
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.010304 -0.038862 -1.523774 -0.238943 -0.560938 1.504731 -0.736468 0.002324 0.733613 0.698964 0.413615 1.343728 1.330175
84 N08 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 7.095084 24.511368 0.256342 13.027577 0.262563 2.657321 -0.484317 5.994692 0.739151 0.039450 0.622549 2.670939 1.125165
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.147057 -0.015975 -0.430930 -0.029585 0.419083 0.168323 -0.641992 -0.666441 0.737094 0.704362 0.413487 1.455059 1.366941
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.648404 6.267655 -0.100187 0.895415 7.107370 -0.954118 1.123724 20.294817 0.735418 0.664839 0.409344 2.785721 2.195779
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 9.391461 7.332932 -1.979307 0.794691 16.004693 2.499699 29.864689 1.706819 0.684106 0.723200 0.392404 3.250872 2.620423
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.153950 1.349105 -0.783965 -0.366375 -0.225554 3.721898 3.487639 0.905220 0.738626 0.710509 0.394778 1.778246 1.477415
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.109069 0.995583 -1.308015 -0.543264 1.634352 1.386924 -0.712095 -0.647031 0.747729 0.710928 0.398882 3.350167 2.720272
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.302006 -0.629557 0.340009 1.116175 -0.774270 0.162428 0.165707 2.564068 0.736264 0.693100 0.400412 2.834514 2.547932
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.116718 0.291571 -1.145707 -1.097550 0.854225 1.357409 2.130295 1.393325 0.740883 0.710461 0.412615 1.449569 1.359706
92 N10 RF_maintenance 100.00% 88.18% 100.00% 0.00% 100.00% 0.00% 38.759844 48.149231 -1.041529 -0.513744 2.842839 5.586568 0.507899 10.204979 0.310284 0.252702 0.116792 2.113976 1.649611
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.913631 0.190644 1.216201 0.636181 3.441761 -0.290103 6.302143 -0.631934 0.727472 0.694104 0.417856 3.291873 2.628213
94 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.812607 -1.348273 0.085758 0.614650 1.363026 1.857272 4.691926 5.651535 0.729187 0.684910 0.424979 3.152147 2.543432
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 1.14% -1.054735 0.943391 0.091006 0.730048 0.397493 -0.156854 0.316843 1.746047 0.690698 0.661289 0.422568 1.449386 1.452960
99 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.344982 -0.146734 -0.174593 -0.268796 -0.779747 5.174788 1.614080 -0.670311 0.707294 0.685130 0.423067 2.686996 2.761388
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.952809 -0.958649 0.278737 1.318955 -0.069633 -0.337753 0.256482 -0.338899 0.716685 0.681677 0.413999 1.418986 1.399278
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.793964 7.699969 -1.957955 -0.294538 1.063606 0.168103 0.049579 -0.400663 0.745667 0.705296 0.408818 2.752150 2.596414
102 N08 RF_maintenance 100.00% 59.72% 100.00% 0.00% 100.00% 0.00% 8.538512 12.072308 8.227581 9.445779 2.861879 3.097299 0.529803 4.687222 0.390224 0.040560 0.322125 1.434634 1.214703
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 23.599852 24.865620 10.633582 11.415086 2.668837 3.451805 10.896031 9.868984 0.026619 0.027081 0.001135 1.127047 1.125389
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.474226 57.440862 -0.364094 8.635764 2.236486 2.958016 -0.284639 0.087987 0.749649 0.658102 0.439423 2.879755 2.160362
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 15.43% 0.281436 0.425197 -0.409356 -0.507388 -0.477313 1.221946 -0.004903 -0.531388 0.744038 0.712041 0.396786 1.983536 1.744802
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.062956 0.694042 -0.208994 -0.113092 3.890060 2.959829 0.456107 0.500852 0.738344 0.705256 0.398087 1.705293 1.543186
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 4.57% 2.004747 0.383807 0.613715 0.679049 -0.543284 -0.036901 1.384107 2.914986 0.724171 0.699712 0.397276 1.694071 1.637684
108 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 2.720492 3.891881 6.638001 -0.262327 4.359394 0.288182 0.988643 2.197022 0.624988 0.708095 0.453789 1.997342 2.994138
109 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.939234 11.735119 0.096041 9.714299 0.892694 2.870088 3.096850 1.947421 0.739669 0.034811 0.519939 3.333904 1.208604
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 10.544367 26.493348 -0.853103 13.188700 11.819864 2.673238 20.830722 5.179574 0.689677 0.031090 0.447313 4.872404 1.185691
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.175224 11.666289 0.711541 9.826431 0.975562 2.843298 0.412775 2.638198 0.732859 0.034369 0.519523 3.456717 1.191130
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -1.069773 -0.708156 0.394344 0.319586 0.364340 -0.661841 1.248753 -0.530637 0.722266 0.686628 0.429106 1.507742 1.339061
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 3.43% -1.136813 0.033578 -0.402311 -0.745426 1.704737 -0.733699 1.377427 -0.412186 0.697521 0.672267 0.427435 1.455723 1.435562
117 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 11.094904 13.405770 9.208651 10.313617 2.424045 3.065838 1.608488 4.098259 0.027605 0.031319 0.003086 1.202980 1.197343
118 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.141244 0.580683 -0.396746 0.400681 1.588619 5.710280 0.298770 0.907805 0.723355 0.693419 0.416957 3.199553 2.718349
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.276013 0.852500 -2.232032 2.259218 -0.296096 20.516570 -0.355353 2.898225 0.735576 0.666581 0.420609 2.704893 2.249131
120 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 2.453233 24.235288 -0.338567 12.954526 1.694763 2.924284 1.367030 10.540535 0.739411 0.035127 0.631682 2.765096 1.131483
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.600524 5.401663 -0.730936 -0.285397 0.520364 1.797315 43.451145 16.912249 0.748222 0.712562 0.412791 3.331141 2.663623
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 8.071563 7.054230 0.536411 1.160621 3.111423 0.274667 -0.177360 -0.673496 0.749905 0.712100 0.409200 3.136899 2.592166
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.017819 9.328882 -0.922921 0.604284 0.260216 2.102357 -0.559980 -0.263395 0.755210 0.720259 0.406049 3.021751 2.672794
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.589978 0.453590 -0.737321 0.218667 1.083167 0.460961 0.623461 0.883217 0.751352 0.717272 0.405074 1.710000 1.470796
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.090528 -0.712985 0.225730 -0.576238 -0.315043 1.895045 -0.477515 -0.622984 0.730403 0.709617 0.404408 3.363884 3.086093
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 15.796069 0.742564 -1.369776 0.393582 9.374498 -0.560503 15.131356 -0.524811 0.674305 0.702495 0.406802 3.141496 2.889649
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.701161 -0.155088 1.095020 0.540267 -0.238917 0.587644 -0.034662 2.815255 0.737083 0.709001 0.412259 1.549507 1.492091
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.647063 3.719527 -0.000856 -0.205097 1.312169 -0.929230 -0.328060 -0.485992 0.742692 0.696283 0.411937 1.612516 1.535029
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.451966 -1.291348 -0.423979 -0.202286 1.014836 1.509522 0.171591 -0.330336 0.732526 0.700957 0.422640 1.981079 1.479091
130 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 1.062578 0.169952 0.221224 0.703480 0.900159 0.265882 0.093768 2.753392 0.717141 0.688287 0.421283 1.659071 1.413447
135 N12 digital_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -1.035046 11.782717 -0.286811 10.051433 -0.226580 3.114872 -0.096645 1.197003 0.701405 0.039298 0.508066 3.514347 1.311825
136 N12 digital_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.806987 0.346233 -0.308136 -0.456470 -0.187891 3.555760 0.002162 0.421551 0.694208 0.670161 0.422620 3.144015 2.816834
137 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.219858 -0.856187 -0.287056 0.185726 0.211973 6.754175 0.648974 0.273143 0.704983 0.672593 0.420489 3.005603 2.611937
138 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.361633 0.099512 1.189668 1.313844 -0.032876 1.454798 5.483074 -0.419751 0.721270 0.687002 0.423721 2.920243 2.595980
140 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 2.831650 12.573506 2.315003 9.919316 -0.065695 2.814059 -2.416120 2.984079 0.732830 0.052499 0.529600 2.767508 2.024195
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -1.017400 3.376123 -2.068783 2.564131 0.190097 0.700836 -0.234917 -4.611331 0.744492 0.684089 0.408882 1.546814 1.401424
142 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 0.669377 11.680173 -1.000672 9.985336 0.995559 2.980408 1.468098 1.838778 0.739644 0.048581 0.539993 3.013176 1.867538
143 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.744019 -0.633128 0.500722 0.424683 -0.253101 -0.549191 -0.288926 -0.633606 0.726583 0.703886 0.398034 1.797184 1.467438
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.573479 -0.499763 -0.631843 -2.274005 10.401640 -0.772883 0.449939 18.898239 0.737020 0.708557 0.403433 3.331689 3.075919
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.539761 12.063600 9.264320 10.032058 2.350958 2.993512 2.092090 3.714580 0.034375 0.027751 0.004202 1.219502 1.216797
147 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.630493 -1.171508 -0.870243 0.066697 4.037309 0.942951 19.338133 -0.408191 0.726727 0.703078 0.407706 3.386892 2.882594
148 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.549559 0.120145 0.289377 0.811085 -0.064193 -0.139702 1.469348 0.592666 0.736443 0.702096 0.414884 3.738824 2.992723
149 N15 RF_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 1.511553 12.445101 0.884864 10.000358 -0.188241 3.001465 0.873788 2.532462 0.726170 0.033275 0.558445 4.407952 1.220947
150 N15 RF_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.769303 11.790279 9.190506 9.973835 2.275862 2.987025 2.716679 2.667099 0.026165 0.028253 0.000599 1.162781 1.161097
151 N16 not_connected 100.00% 5.91% 0.00% 0.00% 100.00% 0.00% 25.707814 -0.163112 -1.661940 -0.932941 2.045383 -2.056359 4.516063 -0.353517 0.587842 0.638300 0.415299 2.254765 2.214451
152 N16 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.177396 -0.280068 -2.944492 -2.703213 -1.011706 -1.431999 16.086280 -0.431565 0.682200 0.660770 0.448466 2.416330 2.351887
153 N16 not_connected 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 10.475126 -0.402157 3.117516 -2.937149 2.368111 9.310174 1.041268 -0.473250 0.040153 0.650722 0.553013 1.205683 2.337542
154 N16 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.153940 -1.228457 -0.774832 -1.420858 -0.699684 -1.672101 -1.557198 -1.510296 0.682425 0.653713 0.456029 2.589724 2.554253
155 N12 digital_maintenance 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 9.975350 -0.234805 8.857342 -0.124762 2.169611 4.014038 0.663554 2.721115 0.058128 0.670528 0.497563 1.239181 3.027603
156 N12 digital_ok 100.00% 76.37% 0.00% 0.00% 100.00% 0.00% 7.802259 0.143244 8.787571 -0.582996 1.539962 0.175862 1.238966 0.019039 0.313703 0.678320 0.472903 1.569126 3.400243
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.602600 -0.241300 -1.033755 -0.567130 0.165175 0.728280 -0.278690 -0.074282 0.719721 0.683849 0.424375 1.604003 1.404946
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.193926 -0.714985 -2.657474 -0.715508 -0.059299 -0.442814 5.706956 28.456871 0.735234 0.692065 0.427208 3.505164 3.248034
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 3.283737 1.796175 2.333077 1.718913 -0.319141 0.160746 -3.713421 -3.587447 0.732490 0.689891 0.410880 1.515388 1.406946
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.017653 28.818069 -0.735696 -0.531159 -0.050166 27.365867 -0.183587 1.519927 0.739214 0.558326 0.381163 3.339509 3.736181
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 2.211198 0.035086 6.260268 3.316419 0.611216 4.546180 0.714775 0.592347 0.649730 0.680863 0.421175 2.335046 2.738258
163 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 9.453302 11.016237 9.057826 9.853593 2.178396 2.886142 0.669310 1.252467 0.027412 0.026104 0.001051 1.246584 1.237455
164 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.491291 12.093954 9.075655 10.031703 2.391722 3.140130 0.859664 0.847753 0.032111 0.037244 0.002713 1.235873 1.231682
165 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.249027 -0.021924 -2.075688 0.339645 2.698153 0.242287 0.191738 -0.025640 0.739830 0.692808 0.415618 1.453690 1.367868
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 19.232505 25.466315 -0.182007 0.149044 4.468529 3.008963 37.971752 62.046498 0.658065 0.576749 0.296881 2.531233 2.644866
167 N15 digital_ok 100.00% 6.98% 0.54% 0.00% 100.00% 0.00% 48.971446 40.341425 -1.086572 -0.643655 2.680346 2.240380 31.196379 84.476361 0.547097 0.552295 0.254833 2.354706 2.128512
168 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.485383 0.737888 0.855001 0.249788 -0.196137 -0.531826 0.502069 0.235795 0.731788 0.694334 0.420226 3.561716 2.999777
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 2.86% -0.763376 2.995621 0.617152 0.797431 0.036901 -1.227173 -0.075157 1.375889 0.733089 0.676648 0.426739 1.953609 1.645123
170 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.315191 1.273564 -0.566082 -0.043641 -0.598497 0.495423 12.425536 2.778231 0.725342 0.691465 0.431902 3.114633 2.749721
171 N16 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.322313 2.570858 -2.728890 0.213363 -0.914839 -1.171654 -0.399993 -0.236156 0.688585 0.598161 0.437204 2.538553 2.060072
173 N16 not_connected 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 12.262893 12.642557 2.743509 3.566731 2.185882 2.860662 3.824983 8.684479 0.035563 0.039860 0.004850 1.215957 1.216925
176 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.127152 0.175805 -0.582420 -0.139417 -0.441158 0.737299 -0.464343 9.572915 0.702783 0.665698 0.439046 3.654294 3.275025
177 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.741418 -1.057030 0.697691 -0.581605 0.791595 0.382396 -0.537893 1.940900 0.709879 0.670675 0.435456 1.605934 1.404389
178 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.479526 -0.522164 1.368727 0.166766 0.680448 3.479725 4.539970 1.435950 0.702194 0.679125 0.434360 3.098557 2.984576
179 N12 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.985450 12.745026 9.339126 10.456544 2.515422 3.392573 0.676120 1.178051 0.042175 0.088702 0.037914 1.228432 1.237986
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.354704 12.583797 -1.093573 10.111837 -0.298745 3.082054 -0.271485 2.454678 0.737842 0.060496 0.545319 3.737596 4.887046
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 1.507260 -1.401916 1.887293 -0.669933 -0.600791 -1.066337 -3.606210 2.344892 0.740329 0.701601 0.419110 1.450396 1.323748
182 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.068881 2.869608 5.191632 1.945917 -1.499869 -0.148649 8.544250 8.252164 0.684501 0.691758 0.423817 2.249051 2.638950
183 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 10.550390 -0.609873 9.043277 1.798838 2.178138 1.135710 0.024910 0.636988 0.035922 0.680701 0.479997 1.237443 2.669169
184 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.323640 12.151803 9.274948 10.001226 2.264509 2.912455 0.720814 0.901572 0.029965 0.026394 0.002133 1.222496 1.208781
185 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.626677 -0.554735 0.764608 0.892996 -0.624787 0.191861 2.276186 2.593946 0.726789 0.681170 0.414855 1.551840 1.361450
186 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.657424 -0.428690 0.639127 0.413660 0.025154 0.218657 5.270954 3.027321 0.729084 0.688473 0.418265 3.819538 3.419060
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.087723 -0.833482 0.891917 0.479627 0.116475 -0.064386 5.619399 2.719630 0.718327 0.686498 0.415064 2.693828 2.614957
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 4.00% 0.712094 1.433126 -0.627452 -0.752241 0.919586 -0.570181 0.473888 3.925453 0.729069 0.692106 0.425045 2.208100 1.585891
190 N15 digital_ok 100.00% 23.20% 100.00% 0.00% 100.00% 0.00% 50.881683 11.858369 -1.134300 10.074251 2.352512 3.172687 21.517501 3.074879 0.489863 0.034129 0.358013 2.576924 1.199686
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.579489 -0.561972 -1.074380 0.052978 1.433944 0.492870 8.180793 7.246331 0.726099 0.687671 0.440728 3.008413 2.736069
192 N16 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.837954 5.377201 2.171712 3.481678 1.373990 2.473270 -2.608279 -5.271462 0.703637 0.642839 0.448107 2.736657 2.339564
193 N16 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.369310 -0.409105 3.840205 0.170526 1.683076 -2.180717 -4.919768 -1.079310 0.675838 0.664886 0.459505 2.538903 2.504148
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 11.677385 34.724317 3.163283 -0.482674 2.185114 3.410037 1.970158 7.542657 0.047867 0.203766 0.133169 1.265316 1.970577
201 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.514894 4.291659 3.817539 2.965539 1.539278 1.364325 -4.795942 -4.463510 0.701194 0.654686 0.416668 3.770104 2.971503
202 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.289751 2.628952 -0.476425 -0.162071 -1.386151 -1.706619 -0.594020 2.774215 0.726414 0.618228 0.440737 3.169348 2.298091
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 12.344194 13.715531 2.916053 3.675532 2.252240 2.913555 3.016591 3.319908 0.034512 0.043086 0.002309 1.223095 1.221775
219 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.251480 2.956745 3.956399 2.084045 1.814672 -0.399586 -5.000813 -3.328609 0.675386 0.667176 0.436594 2.757879 2.630908
220 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.840650 -1.211893 -1.942894 -1.641079 -1.186984 -1.514759 3.708152 -0.125735 0.716386 0.670880 0.423089 2.771758 2.527159
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.093749 -0.654940 -1.988026 -1.771988 0.166821 -0.622960 2.187936 0.108954 0.686203 0.668957 0.430821 2.765049 2.644365
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.082346 -0.249793 -1.227557 -1.620480 -0.873165 -1.026048 7.453744 -0.829611 0.717272 0.671610 0.427388 3.484043 2.950660
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.668388 0.789859 -1.750999 -2.615773 -0.621221 -1.738691 1.723462 -0.217009 0.673292 0.646997 0.434714 2.711063 2.582626
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.569838 -1.550056 0.000856 -0.554361 -1.478313 -1.301295 -2.294443 -2.494133 0.722843 0.669562 0.435979 3.164268 2.754486
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.258947 1.733646 -1.323428 -0.855169 -0.264117 -2.074636 4.049462 19.760652 0.715922 0.611247 0.452953 3.196376 2.377412
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.483381 12.813503 -1.294463 6.177185 -0.685319 2.935350 5.781322 3.272262 0.719965 0.047740 0.550331 0.000000 0.000000
321 N02 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.233019 -0.301821 -1.688348 -1.713129 -0.627702 -1.062314 2.344558 1.222324 0.651168 0.596123 0.448175 0.000000 0.000000
322 N05 digital_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.107494 0.861621 -1.072057 0.717192 -1.313868 -1.410983 0.185860 -2.609380 0.638768 0.588772 0.439810 0.000000 0.000000
323 N02 not_connected 100.00% 53.28% 0.00% 0.00% 100.00% 0.00% 23.925133 0.161308 -1.164152 0.177903 -0.127618 -1.957271 4.540753 -1.423122 0.418729 0.579277 0.383970 0.000000 0.000000
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.069933 0.985839 -0.101439 0.195299 -0.231423 -1.937860 1.107644 -0.952978 0.638724 0.583237 0.427785 0.000000 0.000000
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.339604 -1.418263 0.006851 -2.750833 -1.393749 -0.367615 -2.167898 -0.399680 0.675152 0.603326 0.452099 0.000000 0.000000
329 N12 dish_maintenance 100.00% 8.59% 0.00% 0.00% 100.00% 0.00% 3.401886 -1.597836 -0.473986 -2.309416 -1.024419 -0.114174 4.216997 0.431173 0.571417 0.592633 0.436449 0.000000 0.000000
333 N12 dish_maintenance 0.00% 11.28% 0.00% 0.00% 100.00% 0.00% 3.393991 0.188411 -0.627256 -2.874156 -1.391042 -0.773568 1.554590 1.232434 0.567172 0.576950 0.429124 0.000000 0.000000
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 7, 8, 18, 19, 21, 22, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 81, 82, 84, 86, 87, 89, 90, 92, 93, 94, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 116, 117, 118, 119, 120, 121, 122, 123, 125, 126, 135, 136, 137, 138, 140, 142, 144, 145, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 158, 161, 162, 163, 164, 166, 167, 168, 169, 170, 171, 173, 176, 178, 179, 180, 182, 183, 184, 186, 187, 189, 190, 191, 192, 193, 200, 201, 202, 203, 219, 220, 221, 222, 237, 238, 239, 320, 321, 322, 323, 324, 325, 329, 333]

unflagged_ants: [3, 5, 9, 10, 15, 16, 17, 20, 29, 40, 41, 42, 69, 83, 85, 88, 91, 100, 106, 112, 124, 127, 128, 129, 130, 141, 143, 157, 160, 165, 177, 181, 185]

golden_ants: [3, 5, 9, 10, 15, 16, 17, 20, 29, 40, 41, 42, 69, 83, 85, 88, 91, 100, 106, 112, 124, 127, 128, 129, 130, 141, 143, 157, 160, 165, 177, 181, 185]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459858.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

# Figure out where to draw the nodes
node_centers = {}
for node in sorted(set(list(nodes.values()))):
    if np.isfinite(node):
        this_node_ants = [ant for ant in ants + unused_ants if nodes[ant] == node]
        if len(this_node_ants) == 1:
            # put the node label just to the west of the lone antenna 
            node_centers[node] = hd.antpos[ant][node] + np.array([-14.6 / 2, 0, 0])
        else:
            # put the node label between the two antennas closest to the node center
            node_centers[node] = np.mean([hd.antpos[ant] for ant in this_node_ants], axis=0)
            closest_two_pos = sorted([hd.antpos[ant] for ant in this_node_ants], 
                                     key=lambda pos: np.linalg.norm(pos - node_centers[node]))[0:2]
            node_centers[node] = np.mean(closest_two_pos, axis=0)
In [25]:
def Plot_Array(ants, unused_ants, outriggers):
    plt.figure(figsize=(16,16))
    
    plt.scatter(np.array([hd.antpos[ant][0] for ant in hd.data_ants if ant in ants]), 
                np.array([hd.antpos[ant][1] for ant in hd.data_ants if ant in ants]), c='w', s=0)

    # connect every antenna to their node
    for ant in ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', zorder=0)

    rc_color = '#0000ff'
    antm_color = '#ffa500'
    autom_color = '#ff1493'

    # Plot 
    unflagged_ants = []
    for i, ant in enumerate(ants):
        ant_has_flag = False
        # plot large blue annuli for redcal flags
        if use_redcal:
            if redcal_flagged_frac[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=7 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=rc_color, alpha=redcal_flagged_frac[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot medium green annuli for ant_metrics flags
        if use_ant_metrics: 
            if ant_metrics_xants_frac_by_ant[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=antm_color, alpha=ant_metrics_xants_frac_by_ant[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot small red annuli for auto_metrics
        if use_auto_metrics:
            if ant in auto_ex_ants:
                ant_has_flag = True                
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, lw=0, color=autom_color)) 
        
        # plot black/white circles with black outlines for antennas
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4 * (2 - 1 * float(not outriggers)), fill=True, color=['w', 'k'][ant_has_flag], ec='k'))
        if not ant_has_flag:
            unflagged_ants.append(ant)

        # label antennas, using apriori statuses if available
        try:
            bgc = matplotlib.colors.to_rgb(status_colors[a_priori_statuses[ant]])
            c = 'black' if (bgc[0]*0.299 + bgc[1]*0.587 + bgc[2]*0.114) > 186 / 256 else 'white'
        except:
            c = 'k'
            bgc='white'
        plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color=c, backgroundcolor=bgc)

    # label nodes
    for node in sorted(set(list(nodes.values()))):
        if not np.isnan(node) and not np.all(np.isnan(node_centers[node])):
            plt.text(node_centers[node][0], node_centers[node][1], str(node), va='center', ha='center', bbox={'color': 'w', 'ec': 'k'})
    
    # build legend 
    legend_objs = []
    legend_labels = []
    
    # use circles for annuli 
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgecolor='k', markerfacecolor='w', markersize=13))
    legend_labels.append(f'{len(unflagged_ants)} / {len(ants)} Total {["Core", "Outrigger"][outriggers]} Antennas Never Flagged')
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='k', markersize=15))
    legend_labels.append(f'{len(ants) - len(unflagged_ants)} Antennas {["Core", "Outrigger"][outriggers]} Flagged for Any Reason')

    if use_auto_metrics:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=autom_color, markersize=15))
        legend_labels.append(f'{len([ant for ant in auto_ex_ants if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas Flagged by Auto Metrics')
    if use_ant_metrics: 
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=antm_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum([frac for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants]), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Ant Metrics\n(alpha indicates fraction of time)')        
    if use_redcal:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=rc_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum(list(redcal_flagged_frac.values())), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in redcal_flagged_frac.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Redcal\n(alpha indicates fraction of time)')

    # use rectangular patches for a priori statuses that appear in the array
    for aps in sorted(list(set(list(a_priori_statuses.values())))):
        if aps != 'Not Found':
            legend_objs.append(plt.Circle((0, 0), radius=7, fill=True, color=status_colors[aps]))
            legend_labels.append(f'A Priori Status:\n{aps} ({[status for ant, status in a_priori_statuses.items() if ant in ants].count(aps)} {["Core", "Outrigger"][outriggers]} Antennas)')

    # label nodes as a white box with black outline
    if len(node_centers) > 0:
        legend_objs.append(matplotlib.patches.Patch(facecolor='w', edgecolor='k'))
        legend_labels.append('Node Number')

    if len(unused_ants) > 0:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='grey', markersize=15, alpha=.2))
        legend_labels.append(f'Anntenna Not In Data')
        
    
    plt.legend(legend_objs, legend_labels, ncol=2, fontsize='large', framealpha=1)
    
    if outriggers:
        pass
    else:
        plt.xlim([-200, 150])
        plt.ylim([-150, 150])        
       
    # set axis equal and label everything
    plt.axis('equal')
    plt.tight_layout()
    plt.title(f'Summary of {["Core", "Outrigger"][outriggers]} Antenna Statuses and Metrics on {JD}', size=20)    
    plt.xlabel("Antenna East-West Position (meters)", size=12)
    plt.ylabel("Antenna North-South Position (meters)", size=12)
    plt.xticks(fontsize=12)
    plt.yticks(fontsize=12)
    xlim = plt.gca().get_xlim()
    ylim = plt.gca().get_ylim()    
        
    # plot unused antennas
    plt.autoscale(False)    
    for ant in unused_ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', alpha=.2, zorder=0)
        
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='w', ec=None, alpha=1, zorder=0))
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='grey', ec=None, alpha=.2, zorder=0))
        if hd.antpos[ant][0] < xlim[1] and hd.antpos[ant][0] > xlim[0]:
            if hd.antpos[ant][1] < ylim[1] and hd.antpos[ant][1] > ylim[0]:
                plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color='k', alpha=.2) 

Figure 1: Array Plot of Flags and A Priori Statuses¶

This plot shows all antennas, which nodes they are connected to, and their a priori statuses (as the highlight text of their antenna numbers). It may also show (depending on what is finished running):

  • Whether they were flagged by auto_metrics (red circle) for bandpass shape, overall power, temporal variability, or temporal discontinuities. This is done in a binary fashion for the whole night.
  • Whether they were flagged by ant_metrics (green circle) as either dead (on either polarization) or crossed, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.
  • Whether they were flagged by redcal (blue circle) for high chi^2, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.

Note that the last fraction does not include antennas that were flagged before going into redcal due to their a priori status, for example.

In [26]:
core_ants = [ant for ant in ants if ant < 320]
outrigger_ants = [ant for ant in ants if ant >= 320]
Plot_Array(ants=core_ants, unused_ants=unused_ants, outriggers=False)
if len(outrigger_ants) > 0:
    Plot_Array(ants=outrigger_ants, unused_ants=sorted(set(unused_ants + core_ants)), outriggers=True)

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.4.dev12+g1dfcaf5
3.1.5.dev87+gc99f378
In [ ]: